﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using University.Workshop.Business;

namespace University.Workshop.Presenters.Person.Search
{
    public class PresenterSearchPerson
    {
        ISearchPersonView view;
        public PresenterSearchPerson(ISearchPersonView view)
        {
            this.view = view;
        }

        public void SearchPerson()
        {
            try
            {
                Model.Person p = new Model.Person() { PersonId = view.PersonId, Names = view.PersonNamesRelative, LastNames = view.PersonLastNamesRelative };
                view.personFinded = ManagerPerson.SearchPersonByParameter(p);
            }
            catch (Exception ex)
            {
                view.personFinded = null;
                view.NotifyErrorMessage(ex.Message);
            }
        }
    }
}
